# Copyright (c) 2020 MasterOfGrey
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

########################################################################

# Investigate a theorized smuggling route and rescue Hai. You have to do at least three of these missions.

# NOTE: The Hai Leaks Response 6 and 7 missions will break if any of these missions have Hai-home as a destination.

# Logic Register (don't delete)
# # Some subset of these are restricted so you can't pick up enough of them (total 3) to finish the quest at the same time as starting it.
# # Rescues which don't trigger on landing have hints which don't expire until you visit the spaceport at the rescue site so players don't lose them.
# # (Note: The overarching mission description tells you to check spaceports.)
#
# Main Event:
# # Gipeep
# - Minor People logs
# - Cannot be discovered pre-story
# - Includes information to support later progress (critical to at least encounter)
#
# Secondary Events:
# # Yeertle Family and Oonem
# - Minor People logs
# - Can be discovered pre-story (foreshadowing)
# - Potential for recurring appearances
# - to offer
#		or
#			has "Unwanted Cargo: done"
#			has "Hai Leaks Response 6: offered"
# - needs: not "event: hai-human treaty signed"
#
# Filler Events:
# # Prison RPers, Meroot & Lucy
# - Only mission logs
# - Cannot be discovered pre-story
# - to offer
#		has "Hai Leaks Response 6: active"
#


mission "Hai Rescue: Yeertle Hint"
	landing
	name "Investigate a Were-Squirrel"
	description `A truly outlandish rumor has been floating around that there might be a "were-squirrel" (Hai) hiding out on <destination>.`
	source
		near "Betelgeuse" 4
		government "Republic" "Syndicate"
		attributes "spaceport"
		not attributes "station"
		not planet "Prime"
	destination Prime
	to offer
		"combat rating" > 50
		has "Hai Leaks Response 6: active"
		has "event: slightly lost"
		not "Hai Rescue: Yeertle Family: offered"
		not "event: hai-human treaty signed"
		random < 50
	on offer
		conversation
			`As you come in to land at the spaceport, you listen to the usual chatter of captains coming and going. Often this contains useful tidbits, such as which merchants are ticked off at the moment and whether you should expect to wait a while for refueling. Today, though, you overhear a captain telling an acquaintance a remarkable tale.`
			`	Apparently, there is a man-beast on <planet>, and when the other captain laughs at the idea of a modern "werewolf," the first one is quick to clarify that it's more like a meter and a half tall "were-squirrel." There seems to be some confused discussion about the mythology of such beasts being revealed when caught staring at bright lights until a third captain, listening in the same as you, butts in to inform them that one of them stole that from a popular show a few years back.`
			`	You stop listening on your final approach as the conversation descends into a good-natured argument. Nevertheless, it sounds like a lead on a possible stranded Hai that would be worth following up.`
				accept
	to complete
		has "Hai Rescue: Yeertle Family: offered"
	to fail
		has "event: hai-human treaty signed"


mission "Hai Rescue: Yeertle Family"
	name "Return the Yeertle family"
	description "Transport the Yeertle family to <destination>. Payment is <payment>."
	source Prime
	destination Icelake
	passengers 5
	to offer
		"combat rating" > 50
		or
			has "Unwanted Cargo: done"
			has "Hai Leaks Response 6: offered"
		not "event: hai-human treaty signed"
		"Hai Rescue: Yeertle Family (defer count)" < 3
	on defer
		"Hai Rescue: Yeertle Family (defer count)" ++
	on offer
		conversation
			branch nohint
				not "Hai Rescue: Yeertle Hint: offered"
			`Wandering around after dark you find yourself down an alley near the spaceport, huddled in an alcove against the drizzle while you keep an eye out for anything suspicious, apparently last rumored to be around here. After a while, a few dozen meters ahead, you see a short man with a strange necklace. As he walks past a power transfer unit, the man shimmers and you see faintly-visible, squirrel-like features. It seems the necklace is a projector of a human hologram concealing a Hai. He is sticking to the shadows, trying to avoid being seen.`
				goto start
			label nohint
			`Wandering around after dark you find yourself down an alley near the spaceport. The ongoing drizzle increases in intensity and you pause for a moment to huddle in an alcove for a while until it settles down. After a few moments, a few dozen meters ahead, you see a short man with a strange necklace. As he walks past a power transfer unit, the man shimmers and you see faintly-visible, squirrel-like features. It seems the necklace is a projector of a human hologram concealing a Hai. He is sticking to the shadows, trying to avoid being seen.`
			label start
			`	Do you want to talk to him?`
			choice
				`	(Talk to him.)`
				`	(Come back later.)`
					defer
			`	The man's expression doesn't change much as you approach. His holoprojector may not be sophisticated enough to translate Hai facial expressions. You can see exposed wires on the device; this is probably a makeshift projector he produced with limited resources. A well-made version might keep Hai hidden in human space for a long time.`
			`	From the shaking voice, you can tell he's frightened.`
			`	"C-can I help you?"`
			choice
				`	"You're a Hai. Why are you in human space?"`
					goto far
				`	"Do you need a ride home to Hai space?"`
					goto "ride offer"
				`	"How did you make that holoprojector?"`
					goto "made in a cave"
			label "made in a cave"
			`	He pauses and after a brief delay his hologram registers surprise, "You know what this is then?"`
			choice
				`	"Yes, that's a holoprojector and you're a Hai."`
				`	"Yes, I've been looking for someone like yourself."`
			`	He peers at you for a second, perhaps pondering if he can trust you with the answer.`
			`	"Yes, well, holography is my trade, and Hai children sometimes construct holoprojectors for fun. This one is primitive but functional, if only barely, thanks to inferior human components I've had to scavenge."`
			choice
				`	"Do you need a ride home to Hai space?"`
					goto "ride offer"
				`	"You're a Hai. Why are you in human space?"`
			`	"I'm from Icelake. I chartered a flight from Icelake to Allhome with my family. They would have gone on vacation while I would have been at a conference. Instead, the human merchants locked us in a cell and took us here.`
				goto "questioned first"
			label far
			`	He pauses for a second, perhaps pondering if he can trust you with the answer.`
			`	"I'm a holographer from Icelake. I chartered a flight from Icelake to Allhome with my family. They would have gone on vacation while I would have been at a conference. Instead, the human merchants locked us in a cell and took us here.`
			label "questioned first"
			`	"My youngest daughter is very small for her age, and was able to sneak through a vent to unlock our cell. The ship was under-crewed and so we overpowered them. Unfortunately, they had already landed and the ship was locked down. I didn't know how to disable the lock so we could not take off, and for lack of options we've been hiding near here ever since.`
			`	"Can you take us back to <destination>? I have considerable savings back there and can pay you well. Say, <payment>?"`
			choice
				`	"Sure!"`
				`	"Would the Hai government be looking for you?"`
					goto looking
				`	"No, I can't."`
					decline
			`	"Thank you. My name is Duniip Yeertle, by the way. My wife and three children are nearby. They have holoprojectors as well."`
				goto leave
			label "ride offer"
			`	"Yes! Thank you. Some crooked human merchants locked us in a cell and took us here. I've been unable to find anyone who has even heard of Hai space, and I'm afraid to approach the human authorities. You're the first lead I have! I promise I'll pay you well when we return. I can afford <payment> once we're back at <destination>.`
			`	"My name is Duniip Yeertle, by the way. My wife and three children are nearby. They have holoprojectors as well."`
				goto leave
			label looking
			`	The man's holographic expression doesn't change, but his body language shifts in a way that speaks of distress.`
			`	"The Hai government... no. No, they wouldn't. Let's just say that it's not entirely uncommon for Hai to willingly go missing. An occasional tour of duty with the military, a thrill-seeking adventure with the hopes of getting a reaction upon returning, or even... defection to our brethren. If the authorities tried to track down every single Hai who went missing as soon as they went missing, they'd spend their time chasing their tails fruitlessly.`
			`	"Doubtlessly I'm on a register somewhere, with a timer counting down. It is even possible that someone has been told to watch for if I show up on Darkcloak. Ultimately though, the authorities don't often look for missing persons, unless they're very wealthy, until at least four months have passed by. We have been gone for only two."`
			choice
				`	"Do you need a ride home to Hai space?"`
					goto "ride offer"
				`	"Well, let's get you out of here and home safely."`
			`	Turns out relief is an expression his holoprojector does handle. "Thank you! My name is Duniip Yeertle, by the way. My wife and three children are nearby. They have holoprojectors as well."`
				goto leave
			label leave
			`	"Please, follow me back to my house, and we will make our preparations."`
			choice
				`	(Follow him.)`
			`	You walk down a corridor to a stairway that leads to a brick wall. Duniip walks through the wall; apparently this is another of his holograms. You pass through and see a trio of energetic Hai children eating dinner with their mother.`
			`	Duniip turns off his hologram and addresses his family. "I found us a pilot! They're going to take us all the way home."`
			`	The whole family cheers and it turns out they were already packed to leave. Duniip explains they move regularly so they're not found. It takes them under two minutes to finish preparations and don their holoprojectors. Your walk back to the ship is largely uneventful until some men with strange scanners detect the Yeertle family. One man throws a small grenade with a green light on top. You recognize it as a low-level EMP device. All five holograms turn off, along with a nearby bank of lights, but by the time you stumble to a stop and identify the cause you're much closer to your ship than they are to you.`
			`	In the sudden dimness surrounding your group, you quickly cross the remaining distance to your ship as hastily as possible before someone gets a good look at the Yeertles. Looking back, you see the men were not following you; they were running to their own ships. Looks like they're planning to follow you into orbit.`
				launch
	on accept
		dialog `It appears some unsavory types have followed you into orbit in pursuit of the Yeertle family. You could fight them, but they don't look equipped to make the journey back to Hai space successfully; so you could also probably outrun them if you prefer.`
	on complete
		log `Found a Hai family that had been locked up by some crooked merchants meant to be providing transport. A lively bunch, returned them to <planet>.`
		log "Minor People" "Duniip Yeertle" `A holographer from <planet>, he was able to cobble together five holoprojectors from scrap parts while hiding in little more than a cave in order to protect his family.`
		payment 350000
		"hai slave prereq" ++
		dialog `The Yeertle family is ecstatic to be home after their long ordeal and gladly give you <payment>. They promise to run background checks of human pilots before hiring next time.`
	npc
		government "Bounty Hunter that Won't Enter Hai Space"
		personality plunders disables unconstrained
		fleet "Small Core Pirates" 1



mission "Hai Rescue: Ooonem Hint"
	landing
	name "A (Short) Angel of Death"
	description "There have been some mysterious deaths on <destination>."
	source
		near "Alcyone" 3
		government "Republic" "Syndicate"
		attributes "spaceport"
		not attributes "station"
		not planet "Stormhold"
	destination Stormhold
	to offer
		has "Hai Leaks Response 6: active"
		has "event: slightly lost"
		not "Hai Rescue: Ooonem: offered"
		not "Hai Reveal [B01-A] The Blockade Goes Up: offered"
		random < 30
	on offer
		conversation
			`As you come in to land at the spaceport, you listen to the usual chatter of captains coming and going. To your surprise, on one of the lower, less obvious bands, you hear a pair of captains talking about the pirate world of <planet>. Apparently these two have enough connections to profit off the occasional trip there, but one of them is warning the other not to go by at the moment.`
			`	You listen in carefully as the speaker relays that there's some kind of hunt going on there. All the ships are being searched before departure, and there's a lot of paranoid goons with weapons hot. A merchant has been killed on his own ship, while it was parked in the spaceport, and random people keep getting into firefights with a short, hooded, "angel of death" in dark alleyways. So far, no one claims to know what's going on.`
			`	It's really hard to say what this could be, but it might be worth checking out.`
				accept
	to complete
		has "Hai Rescue: Ooonem: offered"
	to fail
		has "Hai Reveal [B01-A] The Blockade Goes Up: offered"


mission "Hai Rescue: Ooonem"
	name "Return Ooonem"
	description "Transport the Hai you rescued to <destination>. Payment is <payment>."
	source "Stormhold"
	destination "Makerplace"
	passengers 1
	to offer
		"combat rating" > 50
		or
			has "Unwanted Cargo: done"
			has "Hai Leaks Response 6: offered"
		not "Hai Reveal [B01-A] The Blockade Goes Up: offered"
		"Hai Rescue: Ooonem (defer count)" < 3
	on defer
		"Hai Rescue: Ooonem (defer count)" ++
	on offer
		conversation
			branch transmitter
				has "Oonem Transmitter"
			branch nohint
				and
					not "Hai Rescue: Ooonem Hint: offered"
					not "Hai Rescue: Ooonem (defer count)" >= 1
			`Following reports of the last time the "angel of death" was sighted, you end up loitering in a twisting street parallel to a main thoroughfare. The few people using it hurry by quickly, and rarely seem to travel any great distance down this street. One very surly looking individual gives you a sour glare on his way past, a collection of weapons on full display. He looks a lot like you'd expect a bounty hunter to look, and as he moves out of sight you observe a shadow, previously motionless, detach from a spot on a wall and head back your direction, laser rifle pointed in the direction of the departing individual. As the shadow approaches, you see there's a lot of hair sticking out from their hood. They might be a Hai. Do you want to talk to them?`
				goto start
			label nohint
			`As you come in you are informed that all the ships are being searched before departure. No sooner do you disembark your ship than you notice that there's a lot of paranoid goons with weapons hot. Like a lot. There seems to be some kind of manhunt going on for a short, hooded, "angel of death" who has been loitering in dark alleyways. So far, no one is explicitly claiming to know what's going on though, and even for a place like this the effort seems... ungoverned. Even to the extent that some groups seem to be actively pretending to be involved while surreptitiously not joining in with groups that leave on the hunt.`
			`	It's all very odd, but one thing you do glean from the constant conversation and the small selection of individuals loudly demanding cooperation is that the "angel of death," as they're calling it, is unusually short and fast, and capable of things which give you reason to suspect they might possibly be a Hai.`
			choice
				`	(Investigate for yourself.)`
				`	(Come back later.)`
					defer
			`	Following reports of the last time the "angel of death" was sighted, you end up loitering in a twisting street parallel to a main thoroughfare. The few people using it hurry by quickly, and rarely seem to travel any great distance down this street. One very surly looking individual gives you a sour glare on his way past, a collection of weapons on full display. He looks a lot like you'd expect a bounty hunter to look, and as he moves out of sight you observe a shadow, previously motionless, detach from a spot on a wall and head back your direction, laser rifle pointed in the direction of the departing individual. As the shadow approaches, you see there's a lot of hair sticking out from their hood. Seems you may have indeed found a Hai. Do you want to talk to them?`
			label start
			choice
				`	(Talk to them.)`
				`	(Come back later.)`
					defer
			`	As you step into their path, the Hai swings the laser rifle towards you and says, "You're either very brave, very stupid, or know something... I should warn you, I'm not going back to them!"`
			`	She watches your expression closely and, when you don't appear to be hostile, settles into a wary but more relaxed stance. "You're not one of them. What do you want with me?"`
			choice
				`	"I was wondering why a Hai is on a pirate planet."`
					goto hai
				`	"Not one of whom?"`
					goto who
				`	"Sorry to bother you. I'll leave you to your business."`
					goto decline
			label hai
			`	"I was going to meet a businessman on Shroud to arrange a large-scale import deal for my research project. I asked a human merchant to take me there, but I was tricked. The businessman doesn't really exist, and the deal was faked. The merchant locked me in a cell and brought me here instead. When he opened the cell, I managed to grab his rifle, shoot him, and hide. It's amazing how slowly humans move."`
				goto "more questions"
			label who
			`	"There are some men looking for me. I've managed to escape them so far; they're not as quick as a Hai. I think they're friends of the merchant who locked me up."`
				goto "more questions"
			label pay
			`	"I have no money with me, but my family on <planet> can pay."`
				goto "more questions"
			label "more questions"
			`	Can you take me back to <destination>? My family can pay for my return.`
			choice
				`	"Yes, I'll take you there."`
				`	"How much will you pay me?"`
					goto pay
				`	"Why are you on a pirate planet?"`
					goto hai
				`	"I'm not one of whom?"`
					goto who
				`	"Sorry, but you'll have to find another ride."`
					goto decline
			`	Good, but now I must ask, is your ship capable? Are you sure? The pirates are fully aware I am here and will likely chase you, even if you're in good standing with the local authorities. I'd rather not die on your ship.`
			choice
				`	"Don't worry. I know how to dodge pirates."`
					goto go
				`	"I have a better ship parked somewhere else. I'll go get that first."`
				`	"You should find a different ride then."`
					decline
			`	She looks at you curiously. "You're a good one, aren't you? Very well, take this transmitter. When you return, come back to this area. Activate it, and I will find you. Come alone."`
			action
				set "Oonem Transmitter"
			`	She quickly keys something into the transmitter, and it beeps before displaying a locked icon on the screen. As soon as she has handed it over, she turns and melts down an alley which you weren't even entirely aware of. The transmitter in your hand is small, and looks custom modified. Whoever this Hai is, she's capable.`
				defer
			label transmitter
			`	You return to the twisting alleyway you first met the mysterious "angel of death" in and activate the transmitter. It's been a little while, but on your way in there was a bulletin out for her capture being broadcast, so it seems she's definitely still at large.`
			`	You have to wait so long you're starting to feel silly, before she suddenly drops in front of you; a rappel rope swinging silently above her head. "Good, you have returned, are you ready to go?"`
			choice
				`	"I'm ready."`
				`	"I'm sorry, but it's too dangerous for me to get you out of here."`
					goto decline
			label go
			`	"Okay. I guess I should have introduced myself... it's easy to forget social niceties in a place like this. My name is Ooonem, and I'm a researcher from <planet>. Thank you for agreeing to take me home."`
			`	The pair of you, at her direction, make your way back to your ship, with you quietly greasing the palms of those at one of the many access points to the spaceport. Despite your precautions, though, as you weave between parked ships on your final approach, you notice several men sitting on a nearby ship's loading ramp looking intently at Ooonem, their guns lying close by. Before the men are able to make a grab for their weapons, Ooonem pulls a gas grenade out of her cloak and throws it at the gunmen in one smooth movement. The grenade lands squarely on the ramp, sending a fine mist all around their ship. The men, hands halfway to their weapons, all drop to the ground instead; from the screams of pain and the sounds of convulsion coming from behind you, they're probably not going to trouble you any longer.`
			`	"I had better leave these behind," she says, dropping a few gas grenades on the ground. "I took them off some pirates a few days ago. They're quite illegal." You notice a label on the grenades: "Sarin Gas: twenty-meter radius." This was a nerve gas grenade that uses one of the older varieties of the gas. They're cheap and plentiful in pirate space.`
			`	You quickly board your ship and immediately take off.`
				launch
			label decline
			`	The woman shakes her head at you and runs off into the shadows. You doubt you'll ever see her again.`
				decline
	on accept
		dialog `Those pursuing Oonem have caught on quickly and followed you into orbit. You'll probably have to fight them, but they're only Core pirates and don't look equipped to make the journey back to Hai space successfully. If you're fast enough, you could probably attempt to simply dodge them instead.`
	on complete
		log `Rescued a kidnapped Hai researcher, Ooonem, from Stormhold and returned her to Makerplace. She was tricked into leaving Hai space for a fake business deal, and the merchant who agreed to take her there kidnapped her instead. Men have been hunting her since she escaped. She doesn't know the real identities of the kidnappers.`
		log "Minor People" "Oonem" `A Hai researcher with a remarkable talent for stealth and laser rifles. Also a predilection for shooting first and not taking prisoners. She escaped kidnapping and survived independently on <origin> for a remarkable length of time where she acquired the moniker "angel of death." She's also quite the capitalist.`
		payment 225000
		"hai slave prereq" ++
		dialog `Ooonem is relieved to return to <planet>. She leads you to her family's home where you're treated to a bountiful dinner. The cuisine is entirely human-Hai fusion dishes. The dessert is accompanied by what Oonem describes as the most delicious spice of all: <payment>.`
	npc
		government "Bounty Hunter that Won't Enter Hai Space"
		personality plunders disables unconstrained
		fleet "Large Core Pirates" 1
		fleet "Small Core Pirates" 1



mission "Hai Rescue: Prison RP Hint"
	landing
	name "Phantom Distress Calls"
	description "Some merchants have mentioned picking up a distress call near <destination> that they couldn't locate the source of."
	source
		near "Mirfak" 4
		government "Republic" "Syndicate"
		attributes "spaceport"
		not attributes "station"
		not planet "Sunracer"
	destination Sunracer
	to offer
		has "Hai Leaks Response 6: active"
		has "event: slightly lost"
		not "Hai Rescue: Prison Role-Players: offered"
		not "event: hai-human treaty signed"
		random < 80
	on offer
		conversation
			`As you come in to land at the spaceport, you listen to the usual chatter of captains coming and going. Out here on the edge of things and toward the Core, it is a popular pastime for merchants to swap ghost stories. In all likelihood, the majority of these stories can be put down to minor failures from cheap, mass-produced Syndicate equipment. Nevertheless, one of them stands out this time.`
			`	It seems a handful of merchants have all been picking up a very faint distress signal in the vicinity of <planet>, but every time they've gone to look for it, they've either experienced some kind of engine warning, or a large group of pirates has jumped into the system, and they've bugged out. Mysteriously the pirates don't seem to have been looking for or pursuing the merchants when they've appeared though.`
			`	It seems like a long-shot, but you wonder if perhaps this might be a legitimate call for help, maybe from someone who can't risk broadcasting themselves too aggressively...`
				accept
	to fail
		not "Hai Leaks Response 6: active"


mission "Hai Rescue: Prison Role-Players"
	# You get to rescue the Hai from "First Contact: Hai"
	landing
	name "Return the Prison Role-Players"
	description "Return Hai prison role-players to <destination>. Payment is <payment>."
	source "Sunracer"
	destination "Allhome"
	passengers 5
	to offer
		has "Hai Leaks Response 6: active"
		not "event: hai-human treaty signed"
		"Hai Rescue: Prison Role-Players (defer count)" < 3
		# No combat rating requirement since there are no NPCs.
	on defer
		"Hai Rescue: Prison Role-Players (defer count)" ++
	on offer
		conversation
			`As you set your landing vector, you detect a very faint distress call directed at your ship. Your scanners show it appears to come from a remote island. Do you want to check it out?`
			choice
				`	(Follow the distress signal.)`
				`	(Ignore it and come back later.)`
					defer
			`	You put your ship down in a forest clearing and step out to find some wary-looking Hai with a directional transmitter and a very broken freighter in pirate colors.`
			`	One of them, a lady, steps forward, and as she does so her face lights up as if she's seen you before. "Captain <last>, Captain <last>! Please help us, we need to get home to <destination>!"`
				goto "actual questions"
			label questions
			`	"Do you want to know anything else, or can we leave now?"`
			label "actual questions"
			choice
				`	"Of course. Let's go."`
					goto go
				`	"How do you know who I am?"`
					goto who
				`	"How did you get here?"`
					goto how
				`	"How much will you pay me?"`
					goto pay
				`	"Sorry, maybe another time."`
					defer
			label who
			`	"You don't remember me? I was the first Hai you met. You were so confused back then and didn't know who or what we were. It was very cute."`
				goto questions
			label how
			`	"There are prison role-play cruises in Hai space where we can ride in a brig with human security guards. My research group thought it would be a fun experience, so we all chartered one," she says.`
			`	"Unfortunately, it was a trick! They were pirates and took us into human space instead. They didn't feed us much, so we all pretended to be too weak to stand. When one of the pirates came in to check on us, we overpowered him. I don't know if they got sloppy or if they were just new at this, but it seems they had forgotten how fast we can be. The other pirate set the ship to crash-land and used an escape pod. Now we're stuck here."`
				goto questions
			label pay
			`	"Ah, well, we can give you what is left of our travel budget: <payment>. The money is on <planet> though, so you'll have to fly us there first."`
				goto questions
			label go
			`	"Excellent! Everyone pile aboard. Let's go back to <planet>!"`
				accept
	on complete
		log `Found some gullible Hai that pirates tricked into a "prison role-play cruise," complete with security guards and a brig. They overpowered the pirate crew who crashed the ship and used escape pods. Returned the Hai to <planet>.`
		payment 565000
		"hai slave prereq" ++
		dialog `The Hai researchers thank you for rescuing them from their ill-fated "prison role-play cruise" and promise to stick to safer pastimes in the future. They happily give you <payment>.`
	# No NPCs for this one since the Pirates are presumed dead.



mission "Hai Rescue: Meroot and Lucy Hint"
	landing
	name "Deep Crevasses"
	description "There could be kidnappers or kidnapped Hai hiding on <destination>."
	source
		near "Zaurak" 4
		government "Republic" "Syndicate"
		attributes "spaceport"
		not attributes "station"
		not planet "Canyon"
	destination Canyon
	to offer
		"combat rating" > 50
		has "Hai Leaks Response 6: active"
		has "event: slightly lost"
		not "Hai Rescue: Meroot and Lucy: offered"
		not "event: hai-human treaty signed"
		random < 80
	on offer
		conversation
			`As you come in to land at the spaceport, you listen to the usual chatter of captains coming and going. You don't hear anything specific to Hai, but when the punchline of a joke is "deep crevasses" on <planet>, it occurs to you that there would be the perfect place for both illicit activities and escapees to hide out under the radar for a long time. It's probably worth a look...`
				accept
	to complete
		has "Hai Rescue: Meroot and Lucy: offered"
	to fail
		has "event: hai-human treaty signed"


mission "Hai Rescue: Meroot and Lucy"
	name "Return Meroot and Lucy"
	description "Transport the scientists you rescued to <destination>. Payment is <payment>."
	source Canyon
	destination Newhome
	passengers 2
	to offer
		"combat rating" > 50
		has "Hai Leaks Response 6: active"
		not "event: hai-human treaty signed"
		"Hai Rescue: Meroot and Lucy (defer count)" < 3
	on defer
		"Hai Rescue: Meroot and Lucy (defer count)" ++
	on offer
		conversation
			`As you walk through a major street, you notice a woman approach an alcove in the side of a building carrying some food. She looks around to see if she's being followed before entering the alcove and covering it with a sheet of steel. You only had a moment to observe, but through the gap you spotted something hiding inside the small alcove which might have had tufts of hair sticking out of the clothing across its body. It's probably a Hai.`
			`	Do you want to investigate?`
			choice
				`	(Investigate.)`
				`	(Come back later.)`
					defer
			`	You knock on the steel sheet, and a woman within the alcove slides it to the side. As she emerges, she carefully moves her body to block your view of the alcove.`
			`	She asks nervously, "Yes, can I help you?"`
			choice
				`	"Why are you hiding a Hai in there?"`
					goto hiding
				`	"Can I help you?"`
					goto help
				`	"No, I was just walking by. Sorry to bother you."`
					decline
			label hiding
			`	Her expression immediately takes on a shade of panic and you hear what sounds like something heavy being picked up in the background. "Please don't tell anyone! We were both kidnapped, but we managed to escape. Now we're hiding here, hoping those people don't find us again."`
				goto trustcheck

			label help
			`	"Yes! Some men kidnapped my friend and I, but she got us out and we managed to escape. We've been hiding here, hoping they don't find us again."`
			label trustcheck
			`	In the background you hear someone hiss, "Lucy! What are you doing, we can't trust them!"`
			choice
				`	"Uh, luf e ow, vai, luf e eh?"`
					goto "come in"
				`	"No really, you can trust me, I promise!"`
			`	Lucy's face goes pale and she seems frozen in shock, while in the background you can hear sounds of someone who is definitely rushing to do something, though you can't see what.`
			choice
				`	"No wait! Luf e ow, vai, luf e eh?"`
			label "come in"
			`	The person in the background stills. "What did you say?"`
			`	You repeat the phrase.`
			`	Somewhere out of sight you hear a string Hai words that sound very exasperated before they address Lucy again. "Let them in, Lucy, they probably are here to help."`
			`	The emphasis placed on the 'are' is thick, and it seems to snap Lucy out of her frozen state. "Oh, uh, yes, alright. If you could fly us to <planet>, we can pay you when we arrive. You'll likely be followed though, so I hope you have a fast ship. I think you should probably come in, and we'll talk about it."`
			choice
				`	(Enter their alcove.)`
				`	"No, I can't help you get home."`
					decline
			`	The alcove is a dead air space between two utility rooms in the basement of a warehouse. The hole in the wall looks like it was recently dug out by a laser cutter. There's a small refrigerator, a two-person cot, an air processor, and a shelf with typical household items. Books are strewn everywhere; the women must be avid readers. It seems they've set up this tiny space as a decent, albeit very small, apartment.`
			`	The human woman slides the sheet of steel back into place behind you both once you're in and says, "I'm Lucy."`
			`	"And I'm Meroot," adds the Hai woman. "I was on Newhome walking to my research lab when some men pulled me into an alley and zapped me with a taser. I woke up in the brig of a spaceship."`
			`	"My experience was similar. I was walking from my biolab to my house on Serpens. Some men jumped out from behind a dune and zapped me."`
			`	Meroot continues, "They took us both here. I was able to struggle out of my handcuffs and sneak the keys from the guard. We escaped together, and we've been hiding for weeks. Please take us to <destination>!"`
			choice
				`	"Sure. Let's go."`
				`	"No, you'll have to find another pilot."`
					decline
			`	The two women put on clothing that thoroughly covers their person. They lead you through a series of ducts and alleys back to the pad where your ship is parked. Just as your airlock opens there's a sharp zapping sound as someone shoots Meroot with a stun gun. You and Lucy duck, and a couple other shots dissipate harmlessly on the bulkhead of your ship. You fire off a couple shots back and, between the two of you, manage to drag Meroot through the airlock, seal it behind you, and lift off. It appears you're being followed into orbit.`
				launch
	on complete
		log `Rescued a pair of researchers: a Hai woman named Meroot and a human woman named Lucy. They were kidnapped by men who brought them to Canyon. Returned them to <planet> where they now live together. They don't know the identities of the kidnappers.`
		payment 315000
		"hai slave prereq" ++
		dialog `Meroot and Lucy thank you for your help and give you <payment>. Lucy decides to live in Hai space with Meroot. "It's safer here," she explains, though you have your doubts. You ask, but the two have no idea who the men that kidnapped them were.`
	npc
		government "Bounty Hunter that Won't Enter Hai Space"
		personality plunders disables unconstrained
		fleet "Large Core Pirates" 1
		fleet "Small Core Pirates" 1



mission "Hai Rescue: Gipeep Hint"
	landing
	name "Lucrative Transport"
	description "You've heard there's some suspiciously lucrative transport jobs on <destination>."
	source
		near "Nihal" 4
		government "Republic" "Syndicate"
		attributes "spaceport"
		not attributes "station"
		not planet "Maelstrom"
	destination Maelstrom
	to offer
		"combat rating" > 50
		has "Hai Leaks Response 6: active"
		has "event: slightly lost"
		not "Hai Rescue: Gipeep: offered"
		not "event: hai-human treaty signed"
		random < 80
	on offer
		conversation
			`As you come in to land at the spaceport, you listen to the usual chatter of captains coming and going. One guy is bragging particularly odiously about some lucrative transport jobs he'd picked up on <planet>. Of course, it could mean nothing, but it's also very suspicious for that particular world. <planet> is not known for lucrative transport jobs, and it could likely be contraband, or worse...`
				accept
	to fail
		has "event: hai-human treaty signed"


mission "Hai Rescue: Gipeep"
	landing
	name "Return Gipeep"
	description "Transport the Hai you rescued to <destination>. Payment is <payment>."
	source "Maelstrom"
	destination "Greenbloom"
	passengers 1
	to offer
		"combat rating" > 50
		has "Hai Leaks Response 6: active"
		not "event: hai-human treaty signed"
	on offer
		conversation
			branch hint
				has "Hai Rescue: Gipeep Hint: offered"
			`As you come in to land one guy is on the comms, bragging particularly odiously about some lucrative transport jobs he'd picked up. This catches your attention only because <origin> is not known for lucrative transport jobs. It could likely be contraband, or worse...`
			label hint
			`After some quiet investigation you find out that all the lucrative transport jobs are coming out of one particular warehouse. The paperwork all looks to be in order, but to be sure you should pick up a job yourself.`
			choice
				`	(Check it out.)`
				`	(Leave.)`
					decline
			`	Surprisingly, when you arrive the warehouse is unattended, which is suspicious in and of itself. Poking around a little you walk by some cargo and hear loud thumping coming from a locked crate. A ring of keys is hanging nearby. Someone could appear at any moment and you could be in trouble. Do you want to check it out?`
			choice
				`	(Examine the crate.)`
				`	(Leave.)`
					decline
			`	One key stands out, it has a symbol you don't recognize that looks like an angry cat in a circle. As you get closer to the thumping, the ordinary-looking crate starts to seem a little strange. At first glance it appears to be the sort of crate that is well-insulated against sound and temperature, but this one must have concealed breathing holes. You can still hear muffled thumping fairly clearly, but outside you hear what sounds like a loading vehicle pull up, and you don't know what's in the crate.`
			`	Do you want to try opening the crate?`
			choice
				`	(Open the crate.)`
				`	(Leave.)`
					decline
			`	You put the key in the lock, turn, and the next thump you hear pushes the crate open so hard it falls over. An angry-looking Hai jumps out and starts yelling at you in its own language.`
			`	After a few seconds, the Hai calms down and speaks in your tongue. "They locked me in a box! I was walking home from a store on <planet>, and some humans pulled me into an alley. They shoved me in a box and now I'm..." the Hai pauses and looks around, "not in Hai space?`
			`	"Please take me home. I'm a ship architect from <planet>. We should hurry before they come back."`
			choice
				`	"Of course. Just hop in my ship."`
					goto accept
				`	"No, I'm not going that way any time soon."`
			`	He makes a frustrated sound in the back of his throat and gives you a pointed and pleading look. "I have nowhere else to go! I'm not exactly inconspicuous. I'll be caught soon. Please, I can pay you well."`
			choice
				`	"In that case, I'll take you."`
				`	"No. You'll have to find another pilot."`
					decline
			label accept
			`	You can hear men approaching through the warehouse entry and the Hai quickly retrieves something from the crate before you both run quickly in the other direction. Soon you hear shots fired, and see them hit a nearby wall. They passed quite close to your head.`
			`	Through luck and skill, the two of you make it to your ship and quickly launch. The escape seemed a little too easy though; they may have been taking pains to avoid hitting your new passenger.`
			`	It appears ships are following you into orbit.`
				launch
	on complete
		log `Rescued a Hai ship architect named Gipeep who was kidnapped near his home on <planet> and transported in a locked cargo crate. The crate's key had a marking on it like an angry cat in a circle.`
		log "Minor People" "Gipeep Anl'ooh" `A Hai ship architect whom you rescued from his captors. His tenacity of spirit may have helped you to do more than just recover him to Hai space.`
		payment 285000
		"hai slave prereq" ++
		dialog `The Hai, who has since introduced himself as Gipeep Anl'ooh, thanks you for helping him finally finish his long walk home from the store. His grateful family give you <payment>. None of them know who kidnapped him or why.`
	npc
		government "Bounty Hunter that Won't Enter Hai Space"
		personality plunders disables unconstrained
		fleet "Large Northern Pirates" 1
		fleet "Small Northern Pirates" 1
